package starfire;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

import starfire.gui.*;
import starfire.ftp.FtpSite;
import javax.swing.border.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: </p>
 * @author zzzhc.starfire@gmail.com
 * @version 1.0
 */

public class JFtpFrame
    extends JFrame {
  JPanel contentPane;
  JMenuBar menuBar = new JMenuBar();
  JMenu fileMenu = new JMenu();
  JMenuItem exitItem = new JMenuItem();
  JToolBar toolBar = new JToolBar();
  MyButton newButton = new MyButton();
  JLabel statusBar = new JLabel();
  BorderLayout borderLayout1 = new BorderLayout();
  JMenuItem siteManagerItem = new JMenuItem();
  JMenuItem quickConnectItem = new JMenuItem();
  FtpMainPanel mainPanel = null;
  JMenuItem pasteURLItem = new JMenuItem();
  JMenuItem reconnectItem = new JMenuItem();
  JMenuItem disconnectItem = new JMenuItem();
  JMenuItem connectGuideItem = new JMenuItem();
  JMenuItem ftpSearchItem = new JMenuItem();
  JMenu editMenu = new JMenu();
  JMenu viewMenu = new JMenu();
  JMenu bookmarkItem = new JMenu();
  JMenu commandMenu = new JMenu();
  JMenu windowMenu = new JMenu();
  JMenu advanceMenu = new JMenu();
  JMenuItem cutItem = new JMenuItem();
  JMenuItem copyItem = new JMenuItem();
  JMenuItem pasteItem = new JMenuItem();
  JMenuItem settingItem = new JMenuItem();
  JMenu helpMenu = new JMenu();
  JMenuItem aboutItem = new JMenuItem();
  JMenu fileDetailInfomationItem = new JMenu();
  JCheckBoxMenuItem longListItem = new JCheckBoxMenuItem();
  JCheckBoxMenuItem shortListItem = new JCheckBoxMenuItem();
  JMenuItem showFileDescriptionItem = new JMenuItem();
  JMenuItem showFileOwnerItem = new JMenuItem();
  JCheckBoxMenuItem showFileSizeItem = new JCheckBoxMenuItem();
  JCheckBoxMenuItem showFileDateItem = new JCheckBoxMenuItem();
  JCheckBoxMenuItem showFileTimeItem = new JCheckBoxMenuItem();
  JCheckBoxMenuItem showFileAttributeItem = new JCheckBoxMenuItem();
  JMenu sortingItem = new JMenu();
  JMenuItem byNameItem = new JMenuItem();
  JMenuItem bySizeItem = new JMenuItem();
  JMenuItem byDateItem = new JMenuItem();
  JMenuItem byTypeItem = new JMenuItem();
  JMenuItem ascendingItem = new JMenuItem();
  JMenuItem descendingItem = new JMenuItem();
  JMenuItem byRawItem = new JMenuItem();
  JMenuItem indexFileItem = new JMenuItem();
  JMenuItem refreshItem = new JMenuItem();
  JMenuItem toolBarItem = new JMenuItem();
  JMenuItem quickConnectBarItem = new JMenuItem();
  JMenuItem addBookmarkItem = new JMenuItem();
  JMenuItem editBookmarkItem = new JMenuItem();
  JMenu userCommandItem = new JMenu();
  JMenuItem defineUserCommandItem = new JMenuItem();
  JMenu operateFileItem = new JMenu();
  JMenu operateDirectoryItem = new JMenu();
  JMenu macroItem = new JMenu();
  JMenuItem viewFileItem = new JMenuItem();
  JMenuItem editFileItem = new JMenuItem();
  JMenuItem runFileItem = new JMenuItem();
  JMenuItem deleteFileItem = new JMenuItem();
  JMenuItem renameFileItem = new JMenuItem();
  JMenuItem removeFileItem = new JMenuItem();
  JMenuItem changeDirectoryItem = new JMenuItem();
  JMenuItem createNewDirectoryItem = new JMenuItem();
  JMenuItem deleteDirectoryItem = new JMenuItem();
  JMenuItem renameDirectoryItem = new JMenuItem();
  JMenuItem newWindowItem = new JMenuItem();
  JMenuItem closeCurrentWindowItem = new JMenuItem();
  JMenuItem closeAllWindowItem = new JMenuItem();
  JMenuItem configItem = new JMenuItem();

  JTabbedPane tabbedPane = new JTabbedPane();
  MyButton siteManagerButton = new MyButton();
  MyButton connectButton = new MyButton();
  MyButton disconnectButton = new MyButton();
  MyButton quickConnectButton = new MyButton();
  MyButton ftpSearchButton = new MyButton();
  MyButton downloadButton = new MyButton();
  MyButton uploadButton = new MyButton();
  MyButton leftButton = new MyButton();
  MyButton rightButton = new MyButton();
  MyButton closeButton = new MyButton();
  JMenu jMenu1 = new JMenu();
  JMenuItem jMenuItem1 = new JMenuItem();
  JMenuItem alloyItem = new JMenuItem();

  //Construct the frame
  public JFtpFrame() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }

  //Component initialization
  private void jbInit() throws Exception {
    contentPane = (JPanel)this.getContentPane();
    contentPane.setLayout(borderLayout1);
    Dimension dimension = this.getToolkit().getScreenSize();
    this.setSize( dimension.width,
                  dimension.height);
    this.setTitle("JFtp");
    statusBar.setText(" ");
    fileMenu.setText("File");
    exitItem.setText("Exit");
    exitItem.addActionListener(new JFtpFrame_exitItem_ActionAdapter(this));
    newButton.setIcon(new ImageIcon(JFtpFrame.class.getResource("new.gif")));
    newButton.addActionListener(new JFtpFrame_newButton_actionAdapter(this));
    newButton.setToolTipText("New Panel");
    quickConnectItem.addActionListener(new
                                       JFtpFrame_quickConnectItem_actionAdapter(this));
    siteManagerItem.setText("SiteManager");
    siteManagerItem.addActionListener(new
                                      JFtpFrame_siteManagerItem_actionAdapter(this));
    quickConnectItem.setText("Quick connect");
    pasteURLItem.setText("Paste URL");
    reconnectItem.setText("Reconnect");
    disconnectItem.setText("Disconnect");
    connectGuideItem.setText("Connect guide");
    ftpSearchItem.setText("Ftp search");
    ftpSearchItem.addActionListener(new JFtpFrame_ftpSearchItem_actionAdapter(this));
    editMenu.setText("Edit");
    viewMenu.setText("View");
    bookmarkItem.setText("Bookmark");
    commandMenu.setText("Command");
    windowMenu.setText("Window");
    advanceMenu.setText("Advance");
    cutItem.setEnabled(false);
    cutItem.setText("Cut");
    copyItem.setEnabled(false);
    copyItem.setText("Copy");
    pasteItem.setEnabled(false);
    pasteItem.setText("Paste");
    settingItem.setText("Setting");
    helpMenu.setText("Help");
    aboutItem.setText("About");
    aboutItem.addActionListener(new JFtpFrame_aboutItem_actionAdapter(this));
    fileDetailInfomationItem.setText("File detail infomation");
    longListItem.setText("Long list");
    shortListItem.setText("Short List");
    showFileDescriptionItem.setText("Show file description");
    showFileOwnerItem.setText("Show file owner");
    showFileSizeItem.setText("Show file size");
    showFileDateItem.setText("Show file date");
    showFileTimeItem.setText("Show file time");
    showFileAttributeItem.setText("Show file attribute");
    sortingItem.setText("Sorting");
    byNameItem.setText("By name");
    bySizeItem.setText("By size");
    byDateItem.setText("By date");
    byTypeItem.setText("By type");
    ascendingItem.setText("Ascending");
    descendingItem.setText("Descending");
    byRawItem.setText("By raw");
    indexFileItem.setText("Index file");
    refreshItem.setText("Refresh");
    toolBarItem.setText("Tool bar");
    quickConnectBarItem.setText("Quick connect bar");
    addBookmarkItem.setText("Add bookmark");
    editBookmarkItem.setText("Edit bookmark");
    userCommandItem.setText("User command");
    defineUserCommandItem.setText("Define");
    operateFileItem.setText("Operate file");
    operateDirectoryItem.setText("Operate directory");
    macroItem.setText("macro");
    viewFileItem.setText("View");
    editFileItem.setText("Edit");
    runFileItem.setText("Run");
    deleteFileItem.setText("Delete");
    renameFileItem.setText("Rename");
    removeFileItem.setText("Remove");
    changeDirectoryItem.setText("Change directory");
    createNewDirectoryItem.setText("Create new directory");
    deleteDirectoryItem.setText("Delete directory");
    renameDirectoryItem.setText("Rename directory");
    newWindowItem.setText("New window");
    closeCurrentWindowItem.setText("Close current window");
    closeAllWindowItem.setText("Close all window");
    configItem.setText("Config");
    siteManagerButton.setToolTipText("SiteManager");
    siteManagerButton.setIcon(new ImageIcon(JFtpFrame.class.getResource("siteManager.gif")));
    siteManagerButton.addActionListener(new JFtpFrame_siteManagerButton_actionAdapter(this));
    connectButton.setToolTipText("connect");
    connectButton.setIcon(new ImageIcon(JFtpFrame.class.getResource("connect.gif")));
    connectButton.addActionListener(new JFtpFrame_connectButton_actionAdapter(this));
    disconnectButton.setToolTipText("disconnect");
    disconnectButton.setIcon(new ImageIcon(JFtpFrame.class.getResource("disconnect.png")));
    disconnectButton.addActionListener(new JFtpFrame_disconnectButton_actionAdapter(this));
    quickConnectButton.setToolTipText("quick connect");
    quickConnectButton.setIcon(new ImageIcon(JFtpFrame.class.getResource("quickConnect.gif")));
    quickConnectButton.addActionListener(new JFtpFrame_quickConnectButton_actionAdapter(this));
    ftpSearchButton.setToolTipText("Ftp Search");
    ftpSearchButton.setIcon(new ImageIcon(JFtpFrame.class.getResource("search.gif")));
    ftpSearchButton.addActionListener(new JFtpFrame_ftpSearchButton_actionAdapter(this));
    downloadButton.setIcon(new ImageIcon(JFtpFrame.class.getResource("download.gif")));
    uploadButton.setToolTipText("upload");
    uploadButton.setIcon(new ImageIcon(JFtpFrame.class.getResource("upload.gif")));
    leftButton.setToolTipText("go left panel");
    leftButton.setIcon(new ImageIcon(JFtpFrame.class.getResource("left.gif")));
    leftButton.addActionListener(new JFtpFrame_leftButton_actionAdapter(this));
    rightButton.setToolTipText("go right panel");
    rightButton.setIcon(new ImageIcon(JFtpFrame.class.getResource("right.gif")));
    rightButton.addActionListener(new JFtpFrame_rightButton_actionAdapter(this));
    closeButton.setToolTipText("close current panel");
    closeButton.setIcon(new ImageIcon(JFtpFrame.class.getResource("close.gif")));
    closeButton.addActionListener(new JFtpFrame_closeButton_actionAdapter(this));
    jMenu1.setText("L&F");
    jMenuItem1.setText("xp");
    jMenuItem1.addActionListener(new JFtpFrame_jMenuItem1_actionAdapter(this));
    alloyItem.setText("alloy");
    alloyItem.addActionListener(new JFtpFrame_alloyItem_actionAdapter(this));
    fileMenu.add(siteManagerItem);
    fileMenu.add(quickConnectItem);
    fileMenu.add(pasteURLItem);
    fileMenu.addSeparator();
    fileMenu.add(reconnectItem);
    fileMenu.add(disconnectItem);
    fileMenu.addSeparator();
    fileMenu.add(connectGuideItem);
    fileMenu.add(ftpSearchItem);
    fileMenu.addSeparator();
    fileMenu.add(exitItem);
    menuBar.add(fileMenu);
    menuBar.add(editMenu);
    menuBar.add(viewMenu);
    menuBar.add(bookmarkItem);
    menuBar.add(commandMenu);
    menuBar.add(windowMenu);
    menuBar.add(advanceMenu);
    menuBar.add(helpMenu);
    this.setJMenuBar(menuBar);

    contentPane.add(statusBar, BorderLayout.SOUTH);
  //  contentPane.add(mainPanel, BorderLayout.CENTER);
    editMenu.add(cutItem);
    editMenu.add(copyItem);
    editMenu.add(pasteItem);
    editMenu.addSeparator();
    editMenu.add(settingItem);
    helpMenu.add(aboutItem);
    viewMenu.add(longListItem);
    viewMenu.add(shortListItem);
    viewMenu.addSeparator();
    viewMenu.add(fileDetailInfomationItem);
    viewMenu.add(sortingItem);
    viewMenu.add(indexFileItem);
    viewMenu.addSeparator();
    viewMenu.add(refreshItem);
    viewMenu.addSeparator();
    viewMenu.add(toolBarItem);
    viewMenu.add(quickConnectBarItem);
    fileDetailInfomationItem.add(showFileSizeItem);
    fileDetailInfomationItem.add(showFileDateItem);
    fileDetailInfomationItem.add(showFileTimeItem);
    fileDetailInfomationItem.add(showFileAttributeItem);
    fileDetailInfomationItem.add(showFileDescriptionItem);
    fileDetailInfomationItem.add(showFileOwnerItem);
    sortingItem.add(byRawItem);
    sortingItem.add(byNameItem);
    sortingItem.add(byTypeItem);
    sortingItem.add(bySizeItem);
    sortingItem.add(byDateItem);
    sortingItem.addSeparator();
    sortingItem.add(ascendingItem);
    sortingItem.add(descendingItem);
    bookmarkItem.add(addBookmarkItem);
    bookmarkItem.add(editBookmarkItem);
    commandMenu.add(operateFileItem);
    commandMenu.add(operateDirectoryItem);
    commandMenu.addSeparator();
    commandMenu.add(macroItem);
    commandMenu.addSeparator();
    commandMenu.add(userCommandItem);
    userCommandItem.add(defineUserCommandItem);
    operateFileItem.add(viewFileItem);
    operateFileItem.add(editFileItem);
    operateFileItem.add(runFileItem);
    operateFileItem.add(deleteFileItem);
    operateFileItem.add(renameFileItem);
    operateFileItem.add(removeFileItem);
    operateDirectoryItem.add(changeDirectoryItem);
    operateDirectoryItem.add(createNewDirectoryItem);
    operateDirectoryItem.add(deleteDirectoryItem);
    operateDirectoryItem.add(renameDirectoryItem);
    windowMenu.add(newWindowItem);
    windowMenu.add(closeCurrentWindowItem);
    windowMenu.add(closeAllWindowItem);
    advanceMenu.add(configItem);
    advanceMenu.add(jMenu1);
    userCommandItem.addSeparator();
    tabbedPane.setTabPlacement(JTabbedPane.BOTTOM);
    initTabbedPane();
    contentPane.add(tabbedPane,BorderLayout.CENTER);
    try
    {
      this.setIconImage(starfire.manager.IconManager.getManager().
                        get("mainIcon.gif").getImage());
    }catch (Exception e){}
    toolBar.add(newButton);
    toolBar.addSeparator();
    toolBar.add(siteManagerButton);
    toolBar.add(connectButton);
    toolBar.add(disconnectButton);
    toolBar.add(quickConnectButton);
    toolBar.addSeparator();
    toolBar.add(ftpSearchButton);
    toolBar.addSeparator();
    toolBar.add(downloadButton);
    toolBar.add(uploadButton);
    toolBar.addSeparator();
    toolBar.add(leftButton);
    toolBar.add(rightButton);
    toolBar.add(closeButton);
    toolBar.addSeparator();
    toolBar.doLayout();
    contentPane.add(toolBar, BorderLayout.NORTH);
    jMenu1.add(jMenuItem1);
    jMenu1.add(alloyItem);
  }

  void initTabbedPane()
  {
    DownloadManagerPanel dmp = new DownloadManagerPanel();
    tabbedPane.insertTab("Manager",null,dmp,"",0);
    createNewFtpMainPanel();
  }

  public JTabbedPane getTabbedPane() {
    return tabbedPane;
  }

  public void createNewFtpMainPanel()
  {
    createNewFtpMainPanel(null);
  }

  public void createNewFtpMainPanel(FtpSite site)
  {
    FtpMainPanel fmp = new FtpMainPanel();
    int index = tabbedPane.getTabCount();
    index = index-1<0?0:index-1;
    String title = null;
    if (site==null)
      title = "New";
    else
      title = site.getHost()+":"+site.getPort();
    tabbedPane.insertTab(title,null,fmp,"",index);
    tabbedPane.setSelectedIndex(index);
    if (site!=null)
      fmp.connect(site);
  }

  //File | Exit action performed
  public void exitItem_actionPerformed(ActionEvent e) {
    System.exit(0);
  }

  //Help | About action performed
  public void jMenuHelpAbout_actionPerformed(ActionEvent e) {
    JFtpFram_AboutBox dlg = new JFtpFram_AboutBox(this);
    Dimension dlgSize = dlg.getPreferredSize();
    Dimension frmSize = getSize();
    Point loc = getLocation();
    dlg.setLocation( (frmSize.width - dlgSize.width) / 2 + loc.x,
                    (frmSize.height - dlgSize.height) / 2 + loc.y);
    dlg.setModal(true);
    dlg.pack();
    dlg.show();
  }

  //Overridden so we can exit when window is closed
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      exitItem_actionPerformed(null);
    }
  }

  void quickConnectItem_actionPerformed(ActionEvent e) {
    Component c = tabbedPane.getSelectedComponent();
    if (c instanceof FtpMainPanel)
    {
      mainPanel = (FtpMainPanel) c;
      mainPanel.showQuickToolBar();
    }
    //quickConnectItem.setEnabled(false);
  }

  void siteManagerItem_actionPerformed(ActionEvent e) {
    SiteManagerDialog dialog = new SiteManagerDialog(this,"SiteManager",true);
    Dimension d = this.getToolkit().getScreenSize();
    Dimension dd = dialog.getSize();
    if (dd.width > d.width) {
      dd.width = d.width;
    }
    if (dd.height > d.height) {
      dd.height = d.height;
    }
    dialog.setLocation( (d.width - dd.width) / 2, (d.height - dd.height) / 2);
    dialog.setVisible(true);

  }

  void ftpSearchItem_actionPerformed(ActionEvent e) {
    FtpSearchFrame fsf = new FtpSearchFrame(this);
    Dimension d = this.getToolkit().getScreenSize();
    Dimension dd = fsf.getSize();
    if (dd.width > d.width) {
      dd.width = d.width;
    }
    if (dd.height > d.height) {
      dd.height = d.height;
    }
    fsf.setLocation((d.width-dd.width)/2,(d.height-dd.height)/2);
    fsf.setVisible(true);
  }

  void onNew(ActionEvent e) {
    createNewFtpMainPanel();
  }

  void tabbedPane_mouseClicked(MouseEvent e) {
    int index = tabbedPane.getSelectedIndex();
    Rectangle inRect = tabbedPane.getBoundsAt(index);
    Rectangle outRect = tabbedPane.getBounds();
    System.out.println(e);
    if (e.getClickCount()==2)
    {
      if (inRect.contains(e.getPoint()))
         return;
      Component c = tabbedPane.getSelectedComponent();
      if (c instanceof FtpMainPanel)
      {
        FtpMainPanel fmp = (FtpMainPanel)c;
        if (!fmp.isConnected())
          tabbedPane.remove(c);
          else
          {
            //do some thing here
          }
      }
    }
    else if (SwingUtilities.isRightMouseButton(e))
    {
      if (inRect==null)
        return;
      if (inRect.contains(e.getPoint()))
      {

      }

    }

  }

  void tabbedPane_mousePressed(MouseEvent e) {
    System.out.println(e);
  }

  void onLeftButton(ActionEvent e) {
    int total = tabbedPane.getTabCount();
    int index = tabbedPane.getSelectedIndex();
    index = (index-1+total)%total;
    tabbedPane.setSelectedIndex(index);
  }

  void onRightButton(ActionEvent e) {
   int total = tabbedPane.getTabCount();
   int index = tabbedPane.getSelectedIndex();
   index = (index+1)%total;
   tabbedPane.setSelectedIndex(index);
  }

  void onCloseButton(ActionEvent e) {
    int index = tabbedPane.getSelectedIndex();
    if (index==-1 || index==tabbedPane.getTabCount()-1)
      return;
    tabbedPane.remove(index);
    index = tabbedPane.getSelectedIndex();
    if (index==tabbedPane.getTabCount()-1)
    {
      tabbedPane.setSelectedIndex(Math.max(index-1,0));
    }
  }

  void jMenuItem1_actionPerformed(ActionEvent e) {
    try {
     // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     UIManager.setLookAndFeel("com.stefankrause.xplookandfeel.XPLookAndFeel");
     //UIManager.setLookAndFeel("com.incors.plaf.alloy.AlloyLookAndFeel");
     SwingUtilities.updateComponentTreeUI(this);
      System.out.println("set xp look and feel");
    }
    catch (Exception exc) {
      exc.printStackTrace();
    }

  }

  void alloyItem_actionPerformed(ActionEvent e) {
    try {
     // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
     //UIManager.setLookAndFeel("com.stefankrause.xplookandfeel.XPLookAndFeel");
     UIManager.setLookAndFeel("com.incors.plaf.alloy.AlloyLookAndFeel");
     SwingUtilities.updateComponentTreeUI(this);
    }
    catch (Exception ex) {
      ex.printStackTrace();
    }

  }

  void aboutItem_actionPerformed(ActionEvent e) {
    JFtpFram_AboutBox about = new JFtpFram_AboutBox(this);
    about.setSize(400,300);
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    about.setLocation((int)((dim.getWidth()-400)/2),(int)((dim.getHeight()-300)/2));
    about.setVisible(true);
  }

  void ftpSearchButton_actionPerformed(ActionEvent e) {
    ftpSearchItem_actionPerformed(e);
  }

  void quickConnectButton_actionPerformed(ActionEvent e) {
    Component c = tabbedPane.getSelectedComponent();
    if (c instanceof FtpMainPanel) {
      mainPanel = (FtpMainPanel) c;
      mainPanel.showQuickToolBar();
    }

  }

  void siteManagerButton_actionPerformed(ActionEvent e) {
    siteManagerItem_actionPerformed(e);
  }

  void onDisconnect(ActionEvent e) {
    FtpMainPanel fmp = null;
    Component comp = tabbedPane.getSelectedComponent();
    if (comp instanceof FtpMainPanel) {
      fmp = (FtpMainPanel)comp;
      fmp.disconnect();
    }

  }

  void onConnect(ActionEvent e) {
    FtpMainPanel fmp = null;
    Component comp = tabbedPane.getSelectedComponent();
    if (comp instanceof FtpMainPanel) {
      fmp = (FtpMainPanel)comp;
      fmp.connect();
    }

  }
}

class JFtpFrame_exitItem_ActionAdapter
    implements ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_exitItem_ActionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.exitItem_actionPerformed(e);
  }
}

class JFtpFrame_quickConnectItem_actionAdapter
    implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_quickConnectItem_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.quickConnectItem_actionPerformed(e);
  }
}

class JFtpFrame_siteManagerItem_actionAdapter
    implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_siteManagerItem_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }

  public void actionPerformed(ActionEvent e) {
    adaptee.siteManagerItem_actionPerformed(e);
  }
}

class JFtpFrame_ftpSearchItem_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_ftpSearchItem_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.ftpSearchItem_actionPerformed(e);
  }
}

class JFtpFrame_newButton_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_newButton_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.onNew(e);
  }
}

class JFtpFrame_tabbedPane_keyAdapter extends java.awt.event.KeyAdapter {
  JFtpFrame adaptee;

  JFtpFrame_tabbedPane_keyAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
}

class JFtpFrame_tabbedPane_mouseAdapter extends java.awt.event.MouseAdapter {
  JFtpFrame adaptee;

  JFtpFrame_tabbedPane_mouseAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void mouseClicked(MouseEvent e) {
    adaptee.tabbedPane_mouseClicked(e);
  }
  public void mousePressed(MouseEvent e) {
    adaptee.tabbedPane_mousePressed(e);
  }
}

class JFtpFrame_tabbedPane_mouseMotionAdapter extends java.awt.event.MouseMotionAdapter {
  JFtpFrame adaptee;

  JFtpFrame_tabbedPane_mouseMotionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
}

class JFtpFrame_leftButton_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_leftButton_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.onLeftButton(e);
  }
}

class JFtpFrame_rightButton_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_rightButton_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.onRightButton(e);
  }
}

class JFtpFrame_closeButton_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_closeButton_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.onCloseButton(e);
  }
}

class JFtpFrame_jMenuItem1_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_jMenuItem1_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.jMenuItem1_actionPerformed(e);
  }
}

class JFtpFrame_alloyItem_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_alloyItem_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.alloyItem_actionPerformed(e);
  }
}

class JFtpFrame_aboutItem_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_aboutItem_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.aboutItem_actionPerformed(e);
  }
}

class JFtpFrame_ftpSearchButton_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_ftpSearchButton_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.ftpSearchButton_actionPerformed(e);
  }
}

class JFtpFrame_quickConnectButton_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_quickConnectButton_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.quickConnectButton_actionPerformed(e);
  }
}

class JFtpFrame_siteManagerButton_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_siteManagerButton_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.siteManagerButton_actionPerformed(e);
  }
}

class JFtpFrame_disconnectButton_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_disconnectButton_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.onDisconnect(e);
  }
}

class JFtpFrame_connectButton_actionAdapter implements java.awt.event.ActionListener {
  JFtpFrame adaptee;

  JFtpFrame_connectButton_actionAdapter(JFtpFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.onConnect(e);
  }
}

